//
// Created by 颖滴哦 on 2023/3/5.
//
// forkexec.c: fork then exec
#include "kernel/types.h"
#include "user/user.h"
int
main()
{
    int pid, status,t;

    pid = fork();
    if(pid == 0){
        char *argv[] = { "echo", "THIS", "IS", "ECHO", 0 };
        exec("echo", argv);
        printf("exec failed!\n");
        exit(1);
    } else {
        printf("parent waiting\n");
        t=wait(&status);
        printf("the child exited with status %d\n", status);
        printf("%d",t);
    }

    exit(0);
}